<include path="header" /> 
	<div class="m-title">
    	<ul>
        	<li><a href="/work/index" class="select">工作</a></li>
            <li><a href="/work/todo">待办</a></li>
            <li><a href="/work/work">任务</a></li>
            <li class="right"><a href="/work/add">+ 工作 | 待办</a></li>
            <li></li>
        </ul>
    </div>
	<!--div class="box"> 
		<form action="/work/add" method="get">
         <div class="work-input-div"> 
         	<input type="hidden" name="uid" value="1" />
            <span>要添加的工作或待办，格式：@某人 工作内容，若省略“@”，则为待办。</span><br />
            <input type="text" id="work-input" name="search" value='安排工作给谁呢？' class="" onFocus="$(this).val(''); $(this).addClass('edit');" onBlur="$(this).val('安排工作给谁呢？'); $(this).removeClass('edit')" onKeyDown="if(window.event.keyCode == 13){if(syncselect>0){sync.work_sm();}else{ return (function(o){ var l=$(o).val().length; if(l==0){ $(o).val(user.username); } body_load('/work/add',{users:$(o).val()}); return false; })(this);}}else if(window.event.keyCode==38){ sync.u(); return false}else if(window.event.keyCode==40){ sync.d(); return false}else if(window.event.keyCode==188){ this.value+=','; sync.work_init(this); return false; }else{  }" onkeyup="if(window.event.keyCode>40){ sync.call(this,'/sync/username');}" autocomplete='off' />            
            <input class="button" type="submit" value="添加"/> 
        </div>
        </form>
    </div-->
    
     <div class="box">
     
    	<ul class="tasklist todo">    	
        	<li>未完成的待办</li>
          	<? if(!empty($unfinished) && count($unfinished) > 0){ foreach($unfinished as $unli){ ?>
            <li  id="todo_li_<?=$unli['todo_id']?>" name="todo_li_<?=$unli['todo_id']?>">
            <form action="/work/finishtodo" method="post" target="ajaxpost" name="form_<?=$unli['todo_id']?>" id="form_<?=$unli['todo_id']?>">
            <div class="left"><a href="/work/viewtodo?id=<?=$unli['todo_id']?>"><?=$unli['subject']?></a></div>            
			<div class="right"><input name="todo_id" type="checkbox" value="<?=$unli['todo_id']?>" onClick="form_<?=$unli['todo_id']?>.submit();" />完成</div>
            <div class="middiv"><?=$unli['end_date']?></div>
            </form>
            </li>
        	<? }} ?>        
        </ul>
        
        
    </div>
  
    <div class="box">
    	<ul class="tasklist todo">
        	<li>未完成的任务</li>
            <? if(!empty($unfin) && count($unfin) > 0){ foreach($unfin as $unli){ ?>
            <li>
            <form target="ajaxpost" id="work_form_<?=$unli['work_id']?>" name="work_form_<?=$unli['work_id']?>" method="post" action="/work/modifyworkpercent">
            <input type="hidden" name="work_id"  value="<?=$unli['work_id']?>" />
            <div class="left"><?=$unli['mk_username'] ?> >> <a href="/work/viewtodo?id=<?=$unli['todo_id']?>"><?=$unli['subject']?></a></div>            
            <div class="right"><input class="workpercent" value="<?=$unli['finish_percent']?>" name="finish_percent" onBlur="work_form_<?=$unli['work_id']?>.submit();" />%&nbsp;&nbsp;&nbsp;</div>
            <div class="middiv"><?=$unli['end_date']?></div>
            </form>
            </li>
        	<? }} ?> 
        </ul>
        <br>
        <iframe id="ajaxpost" name="ajaxpost" class="hidden" width="0" height="0" frameborder="0"></iframe>    
    </div>
    
    <div class="box">
    	<ul class="tasklist todo">    	
        	<li>布置下去而未完成的工作</li>
          	<? if(!empty($unfinished) && count($unfinished) > 0){ foreach($unfinished as $unli){ ?>
            <li  id="todo_li_<?=$unli['todo_id']?>" name="todo_li_<?=$unli['todo_id']?>">
            <form action="/work/finishtodo" method="post" target="ajaxpost" name="form_<?=$unli['todo_id']?>" id="form_<?=$unli['todo_id']?>">
            <div class="left"><a href="/work/viewtodo?id=<?=$unli['todo_id']?>"><?=$unli['subject']?></a>>>"被安排的人"</div>            
			<div class="right"></div>
            <div class="middiv"><?=$unli['end_date']?></div>
            </form>
            </li>
        	<? }} ?>        
        </ul>
        
        
    </div>
<include path="footer" /> 